<template>
  <div class="cantainer">
    <a-breadcrumb class="breadcrumb">
      <a-breadcrumb-item v-for="(item) in breadList" :key="item.name">
        <span>{{ item.meta.title }}</span>
      </a-breadcrumb-item>
    </a-breadcrumb>
    <div class="name">{{ $route.meta.title }}</div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      name: '',
      breadList: []
    }
  },
  created() {
    this.getBreadcrumb()
  },
  methods: {
    getBreadcrumb() {
      this.breadList = []

      this.name = this.$route.name
      this.$route.matched.forEach(item => {
        this.breadList.push(item)
      })
    }
  },
  watch: {
    $route() {
      this.getBreadcrumb()
    }
  }
}
</script>

<style lang="less" scoped>
.cantainer {
  background-color: #FFFFFF;
  padding: 10px 24px;
  height: 80px;

  .name {
    font-weight: 500;
    font-size: 20px;
    margin-top: 6px;
  }
}
</style>
